.class public Lcom/hyphenate/chat/EMConversation;
.super Lcom/hyphenate/chat/EMBase;


# static fields
.field private static final LIST_SIZE:I = 0x200

.field private static final TAG:Ljava/lang/String; = "conversation"


# instance fields
.field emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;


# direct methods
.method constructor <init>(Lcom/hyphenate/chat/adapter/EMAConversation;)V
    .locals 0

    invoke-direct {p0}, Lcom/hyphenate/chat/EMBase;-><init>()V

    iput-object p1, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    return-void
.end method

.method public static msgType2ConversationType(Ljava/lang/String;Lcom/hyphenate/chat/EMMessage$ChatType;)Lcom/hyphenate/chat/EMConversation$EMConversationType;
    .locals 1

    sget-object v0, Lcom/hyphenate/chat/EMMessage$ChatType;->Chat:Lcom/hyphenate/chat/EMMessage$ChatType;

    if-ne p1, v0, :cond_0

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMConversationType;->Chat:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    :goto_0
    return-object v0

    :cond_0
    sget-object v0, Lcom/hyphenate/chat/EMMessage$ChatType;->GroupChat:Lcom/hyphenate/chat/EMMessage$ChatType;

    if-ne p1, v0, :cond_1

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMConversationType;->GroupChat:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    goto :goto_0

    :cond_1
    sget-object v0, Lcom/hyphenate/chat/EMMessage$ChatType;->ChatRoom:Lcom/hyphenate/chat/EMMessage$ChatType;

    if-ne p1, v0, :cond_2

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMConversationType;->ChatRoom:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    goto :goto_0

    :cond_2
    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMConversationType;->Chat:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    goto :goto_0
.end method


# virtual methods
.method public appendMessage(Lcom/hyphenate/chat/EMMessage;)V
    .locals 2

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    iget-object v1, p1, Lcom/hyphenate/chat/EMMessage;->emaObject:Lcom/hyphenate/chat/adapter/message/EMAMessage;

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/adapter/EMAConversation;->appendMessage(Lcom/hyphenate/chat/adapter/message/EMAMessage;)Z

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0, p1}, Lcom/hyphenate/chat/EMConversation$MessageCache;->addMessage(Lcom/hyphenate/chat/EMMessage;)V

    return-void
.end method

.method public clear()V
    .locals 1

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMConversation$MessageCache;->clear()V

    return-void
.end method

.method public clearAllMessages()V
    .locals 1

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->clearAllMessages()Z

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMConversation$MessageCache;->clear()V

    return-void
.end method

.method public conversationId()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->conversationId()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getAllMessages()Ljava/util/List;
    .locals 3

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMConversation$MessageCache;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->latestMessage()Lcom/hyphenate/chat/adapter/message/EMAMessage;

    move-result-object v0

    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    if-eqz v0, :cond_0

    new-instance v2, Lcom/hyphenate/chat/EMMessage;

    invoke-direct {v2, v0}, Lcom/hyphenate/chat/EMMessage;-><init>(Lcom/hyphenate/chat/adapter/message/EMAMessage;)V

    invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    :cond_0
    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/EMConversation$MessageCache;->addMessages(Ljava/util/List;)V

    :cond_1
    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMConversation$MessageCache;->getAllMessages()Ljava/util/List;

    move-result-object v0

    return-object v0
.end method

.method public getAllMsgCount()I
    .locals 1

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->messagesCount()I

    move-result v0

    return v0
.end method

.method getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;
    .locals 4

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMClient;->chatManager()Lcom/hyphenate/chat/EMChatManager;

    move-result-object v0

    iget-object v1, v0, Lcom/hyphenate/chat/EMChatManager;->caches:Ljava/util/Map;

    monitor-enter v1

    :try_start_0
    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMClient;->chatManager()Lcom/hyphenate/chat/EMChatManager;

    move-result-object v0

    iget-object v0, v0, Lcom/hyphenate/chat/EMChatManager;->caches:Ljava/util/Map;

    iget-object v2, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v2}, Lcom/hyphenate/chat/adapter/EMAConversation;->conversationId()Ljava/lang/String;

    move-result-object v2

    invoke-interface {v0, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hyphenate/chat/EMConversation$MessageCache;

    if-nez v0, :cond_0

    new-instance v0, Lcom/hyphenate/chat/EMConversation$MessageCache;

    invoke-direct {v0}, Lcom/hyphenate/chat/EMConversation$MessageCache;-><init>()V

    :cond_0
    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v2

    invoke-virtual {v2}, Lcom/hyphenate/chat/EMClient;->chatManager()Lcom/hyphenate/chat/EMChatManager;

    move-result-object v2

    iget-object v2, v2, Lcom/hyphenate/chat/EMChatManager;->caches:Ljava/util/Map;

    iget-object v3, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v3}, Lcom/hyphenate/chat/adapter/EMAConversation;->conversationId()Ljava/lang/String;

    move-result-object v3

    invoke-interface {v2, v3, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    monitor-exit v1

    return-object v0

    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method

.method public getExtField()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->extField()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getLastMessage()Lcom/hyphenate/chat/EMMessage;
    .locals 2

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMConversation$MessageCache;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->latestMessage()Lcom/hyphenate/chat/adapter/message/EMAMessage;

    move-result-object v1

    if-nez v1, :cond_0

    const/4 v0, 0x0

    :goto_0
    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/hyphenate/chat/EMConversation$MessageCache;->addMessage(Lcom/hyphenate/chat/EMMessage;)V

    :goto_1
    return-object v0

    :cond_0
    new-instance v0, Lcom/hyphenate/chat/EMMessage;

    invoke-direct {v0, v1}, Lcom/hyphenate/chat/EMMessage;-><init>(Lcom/hyphenate/chat/adapter/message/EMAMessage;)V

    goto :goto_0

    :cond_1
    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMConversation$MessageCache;->getLastMessage()Lcom/hyphenate/chat/EMMessage;

    move-result-object v0

    goto :goto_1
.end method

.method public getMessage(Ljava/lang/String;Z)Lcom/hyphenate/chat/EMMessage;
    .locals 2

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0, p1}, Lcom/hyphenate/chat/EMConversation$MessageCache;->getMessage(Ljava/lang/String;)Lcom/hyphenate/chat/EMMessage;

    move-result-object v0

    if-nez v0, :cond_0

    new-instance v0, Lcom/hyphenate/chat/EMMessage;

    iget-object v1, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v1, p1}, Lcom/hyphenate/chat/adapter/EMAConversation;->loadMessage(Ljava/lang/String;)Lcom/hyphenate/chat/adapter/message/EMAMessage;

    move-result-object v1

    invoke-direct {v0, v1}, Lcom/hyphenate/chat/EMMessage;-><init>(Lcom/hyphenate/chat/adapter/message/EMAMessage;)V

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/hyphenate/chat/EMConversation$MessageCache;->addMessage(Lcom/hyphenate/chat/EMMessage;)V

    :cond_0
    iget-object v1, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v1, p1, p2}, Lcom/hyphenate/chat/adapter/EMAConversation;->markMessageAsRead(Ljava/lang/String;Z)Z

    return-object v0
.end method

.method public getMessagePosition(Lcom/hyphenate/chat/EMMessage;)I
    .locals 5

    const/4 v2, -0x1

    if-eqz p1, :cond_0

    invoke-virtual {p1}, Lcom/hyphenate/chat/EMMessage;->getMsgId()Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_0

    invoke-virtual {p1}, Lcom/hyphenate/chat/EMMessage;->getMsgId()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->isEmpty()Z

    move-result v0

    if-eqz v0, :cond_2

    :cond_0
    move v1, v2

    :cond_1
    :goto_0
    return v1

    :cond_2
    invoke-virtual {p1}, Lcom/hyphenate/chat/EMMessage;->getMsgId()Ljava/lang/String;

    move-result-object v3

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMConversation$MessageCache;->getAllMessages()Ljava/util/List;

    move-result-object v4

    const/4 v0, 0x0

    move v1, v0

    :goto_1
    invoke-interface {v4}, Ljava/util/List;->size()I

    move-result v0

    if-ge v1, v0, :cond_3

    invoke-interface {v4, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hyphenate/chat/EMMessage;

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMMessage;->getMsgId()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0, v3}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_1

    add-int/lit8 v0, v1, 0x1

    move v1, v0

    goto :goto_1

    :cond_3
    move v1, v2

    goto :goto_0
.end method

.method public getType()Lcom/hyphenate/chat/EMConversation$EMConversationType;
    .locals 2

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->_getType()Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;

    move-result-object v0

    sget-object v1, Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;->CHAT:Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;

    if-ne v0, v1, :cond_0

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMConversationType;->Chat:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    :goto_0
    return-object v0

    :cond_0
    sget-object v1, Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;->GROUPCHAT:Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;

    if-ne v0, v1, :cond_1

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMConversationType;->GroupChat:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    goto :goto_0

    :cond_1
    sget-object v1, Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;->CHATROOM:Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;

    if-ne v0, v1, :cond_2

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMConversationType;->ChatRoom:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    goto :goto_0

    :cond_2
    sget-object v1, Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;->DISCUSSIONGROUP:Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;

    if-ne v0, v1, :cond_3

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMConversationType;->DiscussionGroup:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    goto :goto_0

    :cond_3
    sget-object v1, Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;->HELPDESK:Lcom/hyphenate/chat/adapter/EMAConversation$EMAConversationType;

    if-ne v0, v1, :cond_4

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMConversationType;->HelpDesk:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    goto :goto_0

    :cond_4
    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMConversationType;->Chat:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    goto :goto_0
.end method

.method public getUnreadMsgCount()I
    .locals 1

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->unreadMessagesCount()I

    move-result v0

    return v0
.end method

.method public getUserName()Ljava/lang/String;
    .locals 1

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->conversationId()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public insertMessage(Lcom/hyphenate/chat/EMMessage;)V
    .locals 2

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    iget-object v1, p1, Lcom/hyphenate/chat/EMMessage;->emaObject:Lcom/hyphenate/chat/adapter/message/EMAMessage;

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/adapter/EMAConversation;->insertMessage(Lcom/hyphenate/chat/adapter/message/EMAMessage;)Z

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0, p1}, Lcom/hyphenate/chat/EMConversation$MessageCache;->addMessage(Lcom/hyphenate/chat/EMMessage;)V

    return-void
.end method

.method public isGroup()Z
    .locals 2

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getType()Lcom/hyphenate/chat/EMConversation$EMConversationType;

    move-result-object v0

    sget-object v1, Lcom/hyphenate/chat/EMConversation$EMConversationType;->GroupChat:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    if-eq v0, v1, :cond_0

    sget-object v1, Lcom/hyphenate/chat/EMConversation$EMConversationType;->ChatRoom:Lcom/hyphenate/chat/EMConversation$EMConversationType;

    if-ne v0, v1, :cond_1

    :cond_0
    const/4 v0, 0x1

    :goto_0
    return v0

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public loadMessages(Ljava/util/List;)Ljava/util/List;
    .locals 4

    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_0
    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_1

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    iget-object v3, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v3, v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->loadMessage(Ljava/lang/String;)Lcom/hyphenate/chat/adapter/message/EMAMessage;

    move-result-object v0

    if-eqz v0, :cond_0

    new-instance v3, Lcom/hyphenate/chat/EMMessage;

    invoke-direct {v3, v0}, Lcom/hyphenate/chat/EMMessage;-><init>(Lcom/hyphenate/chat/adapter/message/EMAMessage;)V

    invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    :cond_1
    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/EMConversation$MessageCache;->addMessages(Ljava/util/List;)V

    return-object v1
.end method

.method public loadMoreMsgFromDB(Ljava/lang/String;I)Ljava/util/List;
    .locals 4

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    sget-object v1, Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;->UP:Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;

    invoke-virtual {v0, p1, p2, v1}, Lcom/hyphenate/chat/adapter/EMAConversation;->loadMoreMessages(Ljava/lang/String;ILcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;)Ljava/util/List;

    move-result-object v0

    new-instance v1, Ljava/util/ArrayList;

    invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_0
    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_1

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hyphenate/chat/adapter/message/EMAMessage;

    if-eqz v0, :cond_0

    new-instance v3, Lcom/hyphenate/chat/EMMessage;

    invoke-direct {v3, v0}, Lcom/hyphenate/chat/EMMessage;-><init>(Lcom/hyphenate/chat/adapter/message/EMAMessage;)V

    invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    :cond_1
    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/EMConversation$MessageCache;->addMessages(Ljava/util/List;)V

    return-object v1
.end method

.method public markAllMessagesAsRead()V
    .locals 2

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/adapter/EMAConversation;->markAllMessagesAsRead(Z)Z

    return-void
.end method

.method public markMessageAsRead(Ljava/lang/String;)V
    .locals 2

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    const/4 v1, 0x1

    invoke-virtual {v0, p1, v1}, Lcom/hyphenate/chat/adapter/EMAConversation;->markMessageAsRead(Ljava/lang/String;Z)Z

    return-void
.end method

.method public removeMessage(Ljava/lang/String;)V
    .locals 3

    const-string/jumbo v0, "conversation"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "remove msg from conversation:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/hyphenate/util/EMLog;->d(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0, p1}, Lcom/hyphenate/chat/adapter/EMAConversation;->_removeMessage(Ljava/lang/String;)Z

    invoke-virtual {p0}, Lcom/hyphenate/chat/EMConversation;->getCache()Lcom/hyphenate/chat/EMConversation$MessageCache;

    move-result-object v0

    invoke-virtual {v0, p1}, Lcom/hyphenate/chat/EMConversation$MessageCache;->removeMessage(Ljava/lang/String;)V

    return-void
.end method

.method public searchMsgFromDB(JILcom/hyphenate/chat/EMConversation$EMSearchDirection;)Ljava/util/List;
    .locals 5

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMSearchDirection;->UP:Lcom/hyphenate/chat/EMConversation$EMSearchDirection;

    if-ne p4, v0, :cond_1

    sget-object v0, Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;->UP:Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;

    :goto_0
    iget-object v1, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v1, p1, p2, p3, v0}, Lcom/hyphenate/chat/adapter/EMAConversation;->searchMessages(JILcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;)Ljava/util/List;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v0

    const/16 v1, 0x200

    if-le v0, v1, :cond_2

    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    move-object v1, v0

    :goto_1
    invoke-interface {v2}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_0
    :goto_2
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_3

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hyphenate/chat/adapter/message/EMAMessage;

    if-eqz v0, :cond_0

    new-instance v3, Lcom/hyphenate/chat/EMMessage;

    invoke-direct {v3, v0}, Lcom/hyphenate/chat/EMMessage;-><init>(Lcom/hyphenate/chat/adapter/message/EMAMessage;)V

    invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_2

    :cond_1
    sget-object v0, Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;->DOWN:Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;

    goto :goto_0

    :cond_2
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    move-object v1, v0

    goto :goto_1

    :cond_3
    return-object v1
.end method

.method public searchMsgFromDB(JJI)Ljava/util/List;
    .locals 7

    iget-object v1, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    move-wide v2, p1

    move-wide v4, p3

    move v6, p5

    invoke-virtual/range {v1 .. v6}, Lcom/hyphenate/chat/adapter/EMAConversation;->searchMessages(JJI)Ljava/util/List;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v0

    const/16 v1, 0x200

    if-le v0, v1, :cond_1

    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    move-object v1, v0

    :goto_0
    invoke-interface {v2}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_0
    :goto_1
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_2

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hyphenate/chat/adapter/message/EMAMessage;

    if-eqz v0, :cond_0

    new-instance v3, Lcom/hyphenate/chat/EMMessage;

    invoke-direct {v3, v0}, Lcom/hyphenate/chat/EMMessage;-><init>(Lcom/hyphenate/chat/adapter/message/EMAMessage;)V

    invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_1

    :cond_1
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    move-object v1, v0

    goto :goto_0

    :cond_2
    return-object v1
.end method

.method public searchMsgFromDB(Lcom/hyphenate/chat/EMMessage$Type;JILjava/lang/String;Lcom/hyphenate/chat/EMConversation$EMSearchDirection;)Ljava/util/List;
    .locals 8

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMSearchDirection;->UP:Lcom/hyphenate/chat/EMConversation$EMSearchDirection;

    if-ne p6, v0, :cond_1

    sget-object v6, Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;->UP:Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;

    :goto_0
    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {p1}, Lcom/hyphenate/chat/EMMessage$Type;->ordinal()I

    move-result v1

    move-wide v2, p2

    move v4, p4

    move-object v5, p5

    invoke-virtual/range {v0 .. v6}, Lcom/hyphenate/chat/adapter/EMAConversation;->searchMessages(IJILjava/lang/String;Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;)Ljava/util/List;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v0

    const/16 v1, 0x200

    if-le v0, v1, :cond_2

    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    move-object v1, v0

    :goto_1
    invoke-interface {v2}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_0
    :goto_2
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_3

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hyphenate/chat/adapter/message/EMAMessage;

    if-eqz v0, :cond_0

    new-instance v3, Lcom/hyphenate/chat/EMMessage;

    invoke-direct {v3, v0}, Lcom/hyphenate/chat/EMMessage;-><init>(Lcom/hyphenate/chat/adapter/message/EMAMessage;)V

    invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_2

    :cond_1
    sget-object v6, Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;->DOWN:Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;

    goto :goto_0

    :cond_2
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    move-object v1, v0

    goto :goto_1

    :cond_3
    return-object v1
.end method

.method public searchMsgFromDB(Ljava/lang/String;JILjava/lang/String;Lcom/hyphenate/chat/EMConversation$EMSearchDirection;)Ljava/util/List;
    .locals 8

    sget-object v0, Lcom/hyphenate/chat/EMConversation$EMSearchDirection;->UP:Lcom/hyphenate/chat/EMConversation$EMSearchDirection;

    if-ne p6, v0, :cond_1

    sget-object v6, Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;->UP:Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;

    :goto_0
    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    move-object v1, p1

    move-wide v2, p2

    move v4, p4

    move-object v5, p5

    invoke-virtual/range {v0 .. v6}, Lcom/hyphenate/chat/adapter/EMAConversation;->searchMessages(Ljava/lang/String;JILjava/lang/String;Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;)Ljava/util/List;

    move-result-object v2

    invoke-interface {v2}, Ljava/util/List;->size()I

    move-result v0

    const/16 v1, 0x200

    if-le v0, v1, :cond_2

    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    move-object v1, v0

    :goto_1
    invoke-interface {v2}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :cond_0
    :goto_2
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_3

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/hyphenate/chat/adapter/message/EMAMessage;

    if-eqz v0, :cond_0

    new-instance v3, Lcom/hyphenate/chat/EMMessage;

    invoke-direct {v3, v0}, Lcom/hyphenate/chat/EMMessage;-><init>(Lcom/hyphenate/chat/adapter/message/EMAMessage;)V

    invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_2

    :cond_1
    sget-object v6, Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;->DOWN:Lcom/hyphenate/chat/adapter/EMAConversation$EMASearchDirection;

    goto :goto_0

    :cond_2
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    move-object v1, v0

    goto :goto_1

    :cond_3
    return-object v1
.end method

.method public setExtField(Ljava/lang/String;)V
    .locals 1

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    invoke-virtual {v0, p1}, Lcom/hyphenate/chat/adapter/EMAConversation;->_setExtField(Ljava/lang/String;)Z

    return-void
.end method

.method public updateMessage(Lcom/hyphenate/chat/EMMessage;)Z
    .locals 2

    iget-object v0, p0, Lcom/hyphenate/chat/EMConversation;->emaObject:Lcom/hyphenate/chat/adapter/EMAConversation;

    iget-object v1, p1, Lcom/hyphenate/chat/EMMessage;->emaObject:Lcom/hyphenate/chat/adapter/message/EMAMessage;

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/adapter/EMAConversation;->updateMessage(Lcom/hyphenate/chat/adapter/message/EMAMessage;)Z

    move-result v0

    return v0
.end method
